package com.corner.system.service.impl;

import com.corner.system.domain.Device;
import com.corner.system.mapper.*;
import com.corner.system.service.DeviceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户 业务层处理
 * 
 * @author corner
 */
@Service
public class DeviceServiceImpl implements DeviceService
{
    private static final Logger log = LoggerFactory.getLogger(DeviceServiceImpl.class);

    @Autowired
    private DeviceMapper deviceMapper;
    @Autowired
    private FarmerUserMapper farmerUserMapper;

    /**
     * 根据电话号查询用户设备
     * @param tel
     * @return
     */
    @Override
    public List<Device> selectByTel(String tel) {

        List<Device> device = deviceMapper.selectByTel(tel);
        return device;
    }

    @Override
    public List<Device> selectByFarmerId(Long farmerId) {
        List<Device> device = deviceMapper.selectByFarmerId(farmerId);
        return device;
    }

    /**
     * 根据电话号查询用户设备数量
     * @param tel
     * @return
     */
    @Override
    public int selectCountsByTel(String tel) {
        int i = deviceMapper.selectCountsByTel(tel);
        return i;
    }
}
